home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
serial
/
dim-1.000
/
dim-1
/
dim-1.03
/
src
/
reinit.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-27
|
646b
|
34 lines
#include "dim.h"
void reinit (int kill_init)
{
FILE
*pslist;
char
buf [256];
int
pid;
if (! (pslist = popen (PSCMD, "r")) )\
error ("can't get processes list\n");
while (fgets (buf, 255, pslist))
if (strstr (buf, GETTYSTRING))
if (! sscanf (buf, " %d", &pid))
error ("can't find PID in ps-output \"%s\"\n", buf);
else if (kill (pid, SIGHUP))
error ("can't kill (%d,SIGHUP) in \"%s\"\n", pid, buf);
pclose (pslist);
if (kill_init)
{
if (kill (PID_INIT, SIGHUP))
error ("can't restart init\n");
printf("init restarted\n");
}
}